/**
 * @description: 「编辑简介」弹窗组件
 * @author: Ruan Jiazhen
 * @date: 2024-03-11 15:38:46
 **/

Component({
  options: {
    virtualHost: true,
  },
  properties: {
    value: {
      type: String,
      value: '',
    },
  },
  data: {
    isShow: false,
    newValue: '',
  },
  lifetimes: {
    attached() {
      this.setData({
        newValue: this.data.value,
      });
    },
  },
  methods: {
    open() {
      this.setData({
        isShow: true,
      });
    },
    close() {
      this.setData({
        isShow: false,
      });
    },
    emptyFunc() {},
    onInput(e: WechatMiniprogram.Input) {
      this.setData({
        newValue: e.detail.value,
      });
    },
    onClickConfirm() {
      this.triggerEvent('confirm', { value: this.data.newValue });
      this.close();
    },
  },
});
